use aod.dta, clear

xtset ccode year

************
* FIGURE 1 *
************

graph box pkmil_pc, over(counterbalancing) plotregion(margin(vlarge)) graphregion(margin(vthin)) ytitle(Percentage of Peacekeepers in Military) b2title("Counterbalancing") box(1, color(black%30))medline(lpattern(dash) lcolor(white) lwidth(medthick)) ylab(0(10)50) scheme(plotplainblind)
graph export figure_1.jpg, as(jpg) width(3000) replace

**************************
* TABLE 1: MAIN MODELS I *
**************************

eststo m1: logit counterbalancing i.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo m2: logit counterbalancing i.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo m3: logit counterbalancing i.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo m4: xtlogit counterbalancing i.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

esttab m1 m2 m3 m4 using "t1.rtf", replace rtf b(%10.3f) drop(lnsig2u) se stats(N ll aic bic re, fmt(0 3 3 3 3) labels("N" "LL" "AIC" "BIC" "Random Effects")) starlevels(* 0.1 ** 0.05 *** 0.01) alignment(c) nobaselevels nonumbers mtitles(none) varwidth(26) modelwidth(7) ti("\b Table 1. \b0 Logistic Regression Estimates I") fonttbl(\f0\fnil Times New Roman;) nogaps nonotes eqlabels(none) label ///
mlabels("(1)" "(2)" "(3)" "(4)") addnote("Logistic regressions with robust standard errors clustered by country in parentheses." "* p<0.1, ** p<0.05, *** p<0.01") order(1.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year)

***************************
* TABLE 2: MAIN MODELS II *
***************************

eststo m5: logit counterbalancing i.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo m6: logit counterbalancing i.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo m7: logit counterbalancing i.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo m8: xtlogit counterbalancing i.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

esttab m5 m6 m7 m8 using "t2.rtf", replace rtf b(%10.3f) drop(lnsig2u) se stats(N ll aic bic re, fmt(0 3 3 3 3) labels("N" "LL" "AIC" "BIC" "Random Effects")) starlevels(* 0.1 ** 0.05 *** 0.01) alignment(c) nobaselevels nonumbers mtitles(none) varwidth(26) modelwidth(7) ti("\b Table 2. \b0 Logistic Regression Estimates II") fonttbl(\f0\fnil Times New Roman;) nogaps nonotes eqlabels(none) label ///
mlabels("(5)" "(6)" "(7)" "(8)") addnote("Logistic regressions with robust standard errors clustered by country in parentheses." "* p<0.1, ** p<0.05, *** p<0.01") order(1.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year)

************
* FIGURE 2 *
************

*2% OR MORE

est restore m3
sum largecontributor_2 if e(sample), d
margins, level(90) dydx(i.largecontributor_2)
marginsplot, scheme(plotplainblind) xtitle("2% or more") ytitle("") recastci(rcap) ciopts(lpattern(solid) lcolor(black%60) lwidth(0.5) fcolor(gray%60)) plotopts(lcolor(gray) lpattern(blank) msymbol(circle)) yline(0, lpattern(dash) lcolor(gray%60) lwidth(0.5)) ylab(.05(.05)-.2) name(two_pc, replace) aspect(1) title("")
graph save 2pc, replace

*5% OR MORE

est restore m7
sum largecontributor_5 if e(sample), d
margins, level(90) dydx(i.largecontributor_5)
marginsplot, scheme(plotplainblind) xtitle("5% or more") ytitle("") recastci(rcap) ciopts(lpattern(solid) lcolor(black%60) lwidth(0.5) fcolor(gray%60)) plotopts(lcolor(gray) lpattern(blank) msymbol(circle)) yline(0, lpattern(dash) lcolor(gray%60) lwidth(0.5)) ylab(.05(.05)-.2) name(five_pc, replace) aspect(1) title("")
graph save 5pc, replace

*COMBINING 2% AND 5%

graph combine 2pc.gph 5pc.gph, colfirst col(2) row(1) ycommon imargin(medium) graphregion(fcolor(white)) ///
l1title("Effect on Pr(Counterbalancing)", size(12pt)) ///
b2title("Large Contributor", size(12pt)) 

graph export figure_2.jpg, as(jpg) width(3000) replace

**************
* APPENDIX A *
**************

**********************************************
* TABLE A1: IN-SAMPLE DESCRIPTIVE STATISTICS *
**********************************************

*ssc install asdoc
est restore m3
asdoc tabstat counterbalancing largecontributor_1 largecontributor_2 largecontributor_3 largecontributor_5 democracy anocracy autocracy polity2 ln_rgdppc ln_realgdp ln_pop ln_milexper ln_milex ln_milper chist interconf intraconf frcol per year cbyrs if e(sample), stats(N mean sd min max) title(Table A1. In-Sample Descriptive Statistics) label save(ta1.rtf) replace

********************************************
* TABLE A2: ADDITIONAL ROBUSTNESS CHECKS I *
********************************************

*Reestimating the fully specified main models (3-4 and 7-8) with controls for Polity5 scores instead of binary regime indicators

eststo a1: logit counterbalancing i.largecontributor_2 polity2 ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a2: xtlogit counterbalancing i.largecontributor_2 polity2 ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

eststo a3: logit counterbalancing i.largecontributor_5 polity2 ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a4: xtlogit counterbalancing i.largecontributor_5 polity2 ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

esttab a1 a2 a3 a4 using "ta2.rtf", replace rtf b(%10.3f) drop(lnsig2u) se stats(N ll aic bic re, fmt(0 3 3 3 3) labels("N" "LL" "AIC" "BIC" "Random Effects")) starlevels(* 0.1 ** 0.05 *** 0.01) alignment(c) nobaselevels nonumbers mtitles(none) varwidth(26) modelwidth(7) ti("{\b Table A2. \b0 Robustness Checks I}") fonttbl(\f0\fnil Times New Roman;) nogaps nonotes eqlabels(none) label ///
mlabels("(A1)" "(A2)" "(A3)" "(A4)") addnote("Logistic regressions with robust standard errors clustered by country in parentheses." "* p<0.1, ** p<0.05, *** p<0.01") order(1.largecontributor_2 1.largecontributor_5 polity2 ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year)

**********************************************
* TABLE A3: ADDITIONAL ROBUSTNESS CHECKS II *
**********************************************

*Reestimating the fully specified main models (3-4 and 7-8) with controls for GDP (ln), instead of GDP per capita (ln)

eststo a5: logit counterbalancing i.largecontributor_2 autocracy anocracy ln_realgdp ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a6: xtlogit counterbalancing i.largecontributor_2 autocracy anocracy ln_realgdp ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

eststo a7: logit counterbalancing i.largecontributor_5 autocracy anocracy ln_realgdp ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a8: xtlogit counterbalancing i.largecontributor_5 autocracy anocracy ln_realgdp ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

esttab a5 a6 a7 a8 using "ta3.rtf", replace rtf b(%10.3f) drop(lnsig2u) se stats(N ll aic bic re, fmt(0 3 3 3 3) labels("N" "LL" "AIC" "BIC" "Random Effects")) starlevels(* 0.1 ** 0.05 *** 0.01) alignment(c) nobaselevels nonumbers mtitles(none) varwidth(26) modelwidth(7) ti("{\b Table A3. \b0 Robustness Checks II}") fonttbl(\f0\fnil Times New Roman;) nogaps nonotes eqlabels(none) label ///
mlabels("(A5)" "(A6)" "(A7)" "(A8)") addnote("Logistic regressions with robust standard errors clustered by country in parentheses." "* p<0.1, ** p<0.05, *** p<0.01") order(1.largecontributor_2 1.largecontributor_5 autocracy anocracy ln_realgdp ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year)

***********************************************
* TABLE A4: ADDITIONAL ROBUSTNESS CHECKS III *
***********************************************

*Reestimating the fully specified main models (3-4 and 7-8) with controls for Military Expenditure (ln), instead of Military Expenditure per Soldier (ln)

eststo a9: logit counterbalancing i.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milex ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a10: xtlogit counterbalancing i.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milex ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

eststo a11: logit counterbalancing i.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milex ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a12: xtlogit counterbalancing i.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milex ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

esttab a9 a10 a11 a12 using "ta4.rtf", replace rtf b(%10.3f) drop(lnsig2u) se stats(N ll aic bic re, fmt(0 3 3 3 3) labels("N" "LL" "AIC" "BIC" "Random Effects")) starlevels(* 0.1 ** 0.05 *** 0.01) alignment(c) nobaselevels nonumbers mtitles(none) varwidth(26) modelwidth(7) ti("{\b Table A4. \b0 Robustness Checks III}") fonttbl(\f0\fnil Times New Roman;) nogaps nonotes eqlabels(none) label ///
mlabels("(A9)" "(A10)" "(A11)" "(A12)") addnote("Logistic regressions with robust standard errors clustered by country in parentheses." "* p<0.1, ** p<0.05, *** p<0.01") order(1.largecontributor_2 1.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milex ln_milper chist interconf intraconf frcol per year)


**********************************************
* TABLE A5: ADDITIONAL ROBUSTNESS CHECKS IV *
**********************************************

*Reestimating the fully specified main models with lagged Large Contributor (2% or more and 5% or more)

eststo a13: logit counterbalancing l.i.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a14: xtlogit counterbalancing l.i.largecontributor_2 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

eststo a15: logit counterbalancing l.i.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a16: xtlogit counterbalancing l.i.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

esttab a13 a14 a15 a16 using "ta5.rtf", replace rtf b(%10.3f) drop(0bL.largecontributor_2 0bL.largecontributor_5  lnsig2u) se stats(N ll aic bic re, fmt(0 3 3 3 3) labels("N" "LL" "AIC" "BIC" "Random Effects")) starlevels(* 0.1 ** 0.05 *** 0.01) alignment(c) nobaselevels nonumbers mtitles(none) varwidth(26) modelwidth(7) ti("{\b Table A5. \b0 Robustness Checks IV}") fonttbl(\f0\fnil Times New Roman;) nogaps nonotes eqlabels(none) label ///
mlabels("(A13)" "(A14)" "(A15)" "(A16)") addnote("Logistic regressions with robust standard errors clustered by country in parentheses." "* p<0.1, ** p<0.05, *** p<0.01") order(1L.largecontributor_2 1L.largecontributor_5 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year)

**********************************************
* TABLE A6: ADDITIONAL ROBUSTNESS CHECKS V *
**********************************************

*Reestimating the fully specified main models with different thresholds for Large Contributor (1% or more and 3% or more)

eststo a17: logit counterbalancing i.largecontributor_1 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a18: xtlogit counterbalancing i.largecontributor_1 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

eststo a19: logit counterbalancing i.largecontributor_3 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a20: xtlogit counterbalancing i.largecontributor_3 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

esttab a17 a18 a19 a20 using "ta6.rtf", replace rtf b(%10.3f) drop(lnsig2u) se stats(N ll aic bic re, fmt(0 3 3 3 3) labels("N" "LL" "AIC" "BIC" "Random Effects")) starlevels(* 0.1 ** 0.05 *** 0.01) alignment(c) nobaselevels nonumbers mtitles(none) varwidth(26) modelwidth(7) ti("{\b Table A6. \b0 Robustness Checks V}") fonttbl(\f0\fnil Times New Roman;) nogaps nonotes eqlabels(none) label ///
mlabels("(A17)" "(A18)" "(A19)" "(A20)") addnote("Logistic regressions with robust standard errors clustered by country in parentheses." "* p<0.1, ** p<0.05, *** p<0.01") order(1.largecontributor_1 1.largecontributor_3 autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year)

**************
* FIGURE A.1 *
**************

*1% OR MORE

est restore a17
sum largecontributor_1 if e(sample), d
margins, level(90) dydx(i.largecontributor_1)
marginsplot, scheme(plotplainblind) xtitle("1% or more") ytitle("") recastci(rcap) ciopts(lpattern(solid) lcolor(black%60) lwidth(0.5) fcolor(gray%60)) plotopts(lcolor(gray) lpattern(blank) msymbol(circle)) yline(0, lpattern(dash) lcolor(gray%60) lwidth(0.5)) ylab(.05(.05)-.2) name(one_pc, replace) aspect(1) title("")
graph save 1pc, replace

*3% OR MORE

est restore a19
sum largecontributor_3 if e(sample), d
margins, level(90) dydx(i.largecontributor_3)
marginsplot, scheme(plotplainblind) xtitle("3% or more") ytitle("") recastci(rcap) ciopts(lpattern(solid) lcolor(black%60) lwidth(0.5) fcolor(gray%60)) plotopts(lcolor(gray) lpattern(blank) msymbol(circle)) yline(0, lpattern(dash) lcolor(gray%60) lwidth(0.5)) ylab(.05(.05)-.2) name(three_pc, replace) aspect(1) title("")
graph save 3pc, replace

*COMBINING 1% AND 3%

graph combine 1pc.gph 3pc.gph, colfirst col(2) row(1) ycommon imargin(medium) graphregion(fcolor(white)) ///
l1title("Effect on Pr(Counterbalancing)", size(12pt)) ///
b2title("Large Contributor", size(12pt))

graph export figure_a1.jpg, as(jpg) width(3000) replace

*********************************************
* TABLE A7: ADDITIONAL ROBUSTNESS CHECKS VI *
*********************************************

eststo a21: logit counterbalancing pkmil_pc autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a22: logit counterbalancing pkmil_pc autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a23: logit counterbalancing pkmil_pc autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "No"

eststo a24: xtlogit counterbalancing pkmil_pc autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year c.cbyrs##c.cbyrs##c.cbyrs, vce(cluster ccode)
estadd local re "Yes"

esttab a21 a22 a23 a24 using "ta7.rtf", replace rtf b(%10.3f) drop(lnsig2u) se stats(N ll aic bic re, fmt(0 3 3 3 3) labels("N" "LL" "AIC" "BIC" "Random Effects")) starlevels(* 0.1 ** 0.05 *** 0.01) alignment(c) nobaselevels nonumbers mtitles(none) varwidth(26) modelwidth(7) ti("{\b Table A7. \b0 Robustness Checks VI}") fonttbl(\f0\fnil Times New Roman;) nogaps nonotes eqlabels(none) label ///
mlabels("(A21)" "(A22)" "(A23)" "(A24)") addnote("Logistic regressions with robust standard errors clustered by country in parentheses." "* p<0.1, ** p<0.05, *** p<0.01") order(pkmil_pc autocracy anocracy ln_rgdppc ln_pop ln_milexper ln_milper chist interconf intraconf frcol per year)